package com.jsoft.service;

import com.jsoft.dto.BookingDto;
import com.jsoft.manager.BookingManager;
import com.jsoft.model.BookingDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

/**
 * Date: 04.09.13
 * Time: 23:32
 */

@Service
public class BookingServiceImpl implements BookingService {
    @Autowired
    private BookingManager bookingManager;

    @Override
    @Transactional(readOnly = true)
    public List<BookingDto> getList() {
        List<BookingDao> bookingDaoList = bookingManager.getAllList();
        List<BookingDto> bookingDtoList = new ArrayList<BookingDto>();
        for (BookingDao dao : bookingDaoList) {
            bookingDtoList.add(dao.wrapBookingDto());
        }
        return bookingDtoList;
    }
}
